<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <script>
        /**
         * 构造函数对象
         */
        function Persion(name,age,gender){
                this.name=name;
                this.age=age;
                this.gender=gender;
                this.sayName = function(){
                    alert(this);
                }
        }


         function Dog(name,age,gender){
                this.name=name;
                this.age=age;
                this.gender=gender;
                this.sayName = function(){
                    alert(this);
                }
        }

        var per = new  Persion("沙和尚",20,"男");
        var per1 = new  Persion("孙悟空",18,"男");
        var per2 = new  Persion("猪八戒",15,"女");

        console.log(per);
        console.log(per1);
        console.log(per2);


        var dog = new Dog("旺财",2,"男");
        console.log(dog);


    </script>
</head>
<body>
    
</body>
</html>